Title: i3, lemonbar, urxvt, and touchegg
Date: 2016-03-16 21:59
Category: CLI
Tags: CLI, i3, debian, dotfiles, touchegg, lemonbar, urxvt


**NOTE:** I've moved away from lemonbar and have reimplmented my bar in polybar, works much better. You can see my polybar conf in my dotfiles.


###Window Manger
####spectrwm
Until recently, I was using [spectrwm] for my Window Manager (WM).
When I first switched from a non tiling WM to spectrwm, I liked it for a lot of reasons.
Overall it reminded me a great deal of [tmux], and tmux really made sense to me.
A few of my friends often told me now nice [i3] was, and I poked it a few times.


I never really had motivation to leave spectrwm, but after a while two things were annoying me.
There were always a few programs that just didn't want to work with spectrwm.
The most obvious examples are various steam games... (while I try to use FOSS, I do have some weak points)
Another issue that annoyed me was that [conky] via spectrwm's bar could only do one font.
There are very few good unicode fonts that exist, and fewer still that do mono space well.
Even [Pragmata Pro] has room to improve.
Of the fonts that do exist, non xft font handling by programs is soooo annoying.
Anyway, I used unicode to reduce horizontal bar space, but it looked meh due to many issues.


####i3
So, I came across a very nice looking bar configuration in i3, using lemonbar, [electro7's i3 lemonbar].
(Due to non xft hijinks, I recommend [krypt-n's lemonbar] instead of normal lemonbar.)
This beauty gave me some inspiration to migrate to i3.
So, I started my move by tinkering with electro7's work, adding things I wanted, and in a few places making the code work better (it used to eat up space for both eth0 and wlan0 up/down speed, even if one was inactive).
Aside from tinkering with having control-pianobar (and/or cmus) output, I think [my mod] is good till I get a bigger monitor.


#####Modes
After my new fancy bar was good, I sat down and started configuring i3 itself.
Priorities, right?
While setting i3 up, I found it can do some fun things with `modes`.

    :::bash
    ### Handy Menu Mode ### {{{
    set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
    mode "$mode_system" {
        bindsym l exec --no-startup-id $Locker, mode "default"
        bindsym e exec --no-startup-id i3-msg exit, mode "default"
        bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
        bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default"
        bindsym r exec --no-startup-id systemctl reboot, mode "default"
        bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"  

        # back to normal: Enter or Escape
        bindsym Return mode "default"
        bindsym Escape mode "default"
    }

    bindsym $mod+Pause mode "$mode_system"
    ### End Handy Menu Mode ### }}}

    ### control-pianobar Mode ### {{{
    mode "control-pianobar" {
        bindsym p exec --no-startup-id ~/.config/pianobar/control-pianobar.sh play, mode "default"
        bindsym q exec --no-startup-id ~/.config/pianobar/control-pianobar.sh quit, mode "default"
        bindsym h exec --no-startup-id ~/.config/pianobar/control-pianobar.sh history, mode "default"
        bindsym n exec --no-startup-id ~/.config/pianobar/control-pianobar.sh next, mode "default"
        bindsym t exec --no-startup-id ~/.config/pianobar/control-pianobar.sh tired, mode "default"
        bindsym s exec --no-startup-id ~/.config/pianobar/control-pianobar.sh switchstation, mode "default"
        bindsym \, exec --no-startup-id ~/.config/pianobar/control-pianobar.sh previousstation, mode "default"
        bindsym . exec --no-startup-id ~/.config/pianobar/control-pianobar.sh nextstation, mode "default"
        bindsym l exec --no-startup-id ~/.config/pianobar/control-pianobar.sh love, mode "default"
        bindsym b exec --no-startup-id ~/.config/pianobar/control-pianobar.sh ban, mode "default"
        bindsym e exec --no-startup-id ~/.config/pianobar/control-pianobar.sh explain, mode "default"
        bindsym c exec --no-startup-id ~/.config/pianobar/control-pianobar.sh current, mode "default"

        # back to normal: Enter or Escape
        bindsym Return mode "default"
        bindsym Escape mode "default"
    }

    bindsym $mod+m mode "control-pianobar"
    ### End control-pianobar Mode ### }}}

Modes let you have completely different bindings then you normally have.
You just have to be careful to revert back to the default mode after a command, or build escape buttons in.


###Other Digressions, err... Programs
####urxvt
In the middle of getting i3 set up, I let the same friends make me think about [urxvt], which I also find I like.
I really wasn't using `terminator` for much besides its color customization.
One of the first things I kill on terminator is its red bar for groups/splits, as I use tmux inside it.


####uzbl
[uzbl] seems like a nice, lightweight GUI web browser, with vim like bindings.
I am using it more and more for random look ups.
I helped encourage myself to use it by getting [rofi-pass] to work, so I can auto fill my passwords.


###Reason I Started Writing This Post
Having recently switched from spectrwm to i3 for my window manager, I have found that there are one or two things that you just can't do with the mouse.
For me, this is mainly switching between workspaces.
(Sure, this is true of spectrwm as well, but this fix can be used there too.)
After a few days of trying to find a method to do this, I came across [touchegg].
> Touchegg is a multitouch gesture program, that runs as a user in the background, and adds multitouch support to window managers.
> -arch wiki

Installing touchegg is pretty simple, but its instructions are biased towards ubuntu.
touchegg tells you to install `build-essential libqt4-dev utouch libgeis-dev libx11-6 libxtst-dev`; on debian sid `utouch` is acually `libgeis-dev`.

Once it is installed, running `touchegg` will put the default config in place.
It will also display some helpful suggestions for testing, and display your actions for debug.
The manual, only found on touchegg's github wiki, suggests a number of synclient settings be turned off:

    :::php
    synclient TapButton2=0
    synclient TapButton3=0
    synclient ClickFinger2=0
    synclient ClickFinger3=0
    synclient HorizTwoFingerScroll=0
    synclient VertTwoFingerScroll=0

Once you do this most of the gestures will work...
Except for pinching, which segfaults.
After testing the available options, I decided four finger swipes are all I need for now, so I reverted my synclient changes.


#####Conf
At this point I just added a few lines to (and deleted unused defaults from) my `~/.config/touchegg/touchegg.conf`  

    <application name="All">

        <gesture type="DRAG" fingers="4" direction="LEFT">
            <action type="SEND_KEYS">Super+U</action>
        </gesture>

        <gesture type="DRAG" fingers="4" direction="RIGHT">
            <action type="SEND_KEYS">Super+O</action>
        </gesture>

    </application>

As well as my `~/.i3/config`.

    :::bash
    ### Cycle Through Workspaces ### {{{
    ## Added for touchegg
    bindsym $mod+u workspace prev
    bindsym $mod+o workspace next
    ### End Cycle Through Workspaces ### }}}


###Links
[spectrwm]  
[tmux]  
[i3]  
[conky]  
[Pragmata Pro]  
[electro7's i3 lemonbar]  
[krypt-n's lemonbar]  
[my mod]  
[urxvt]  
[uzbl]  
[rofi-pass]  
[touchegg]  


[spectrwm]: https://github.com/conformal/spectrwm/wiki
[tmux]: https://tmux.github.io/
[i3]: https://i3wm.org/
[conky]: https://github.com/brndnmtthws/conky
[Pragmata Pro]: http://www.fsd.it/shop/fonts/pragmatapro/
[electro7's i3 lemonbar]: https://github.com/electro7/dotfiles/tree/master/.i3/lemonbar
[krypt-n's lemonbar]: https://github.com/krypt-n/bar
[my mod]: https://notabug.org/demure/dotfiles/src/master/i3/lemonbar
[urxvt]: http://software.schmorp.de/pkg/rxvt-unicode.html
[uzbl]: http://www.uzbl.org/
[rofi-pass]: https://github.com/carnager/rofi-pass
[touchegg]: https://github.com/JoseExposito/touchegg 

